package com.tjec.framework.web.domain;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.tjec.project.businessWorkbench.domain.BmsBusinessTask;
import com.tjec.project.businessWorkbench.domain.BmsProjectDocCatalog;
import com.tjec.project.projectLeaderWorkbeanch.domain.BmsMdExpertType;
import com.tjec.project.system.domain.*;
import com.tjec.project.system.domain.vo.BmsMdBusinessCategoryVO;

/**
 * Treeselect树结构实体类
 * 
 * @author tjec
 */
public class TreeSelect implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    private String id;

    /** 节点名称 */
    private String label;
    
    private String type;

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeSelect> children;

    public TreeSelect()
    {

    }

    public TreeSelect(SysDept dept)
    {
        this.id = dept.getGuid();
        this.label = dept.getDeptName();
        this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(SysMenu menu)
    {
        this.id = menu.getMenuId();
        this.label = menu.getMenuName();
        this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }
    
    public TreeSelect(BmsMdBusinessCategory businessCategory)
    {
        this.id = businessCategory.getGuid();
        this.label = businessCategory.getMenuName();
        this.children = businessCategory.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }
    
    public TreeSelect(BmsMdBusinessCategoryVO businessCategory)
    {
        this.id = businessCategory.getGuid();
        this.label = businessCategory.getMenuName();
        this.children = businessCategory.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }
    
    public TreeSelect(BmsBusinessTask bmsBusinessTask)
    {
        this.id = bmsBusinessTask.getGuid();
        this.label = bmsBusinessTask.getName();
        this.children = bmsBusinessTask.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }
    
    public TreeSelect(BmsProjectDocCatalog bmsProjectDocCatalog)
    {
        this.id = bmsProjectDocCatalog.getGuid();
        this.label = bmsProjectDocCatalog.getName();
        this.children = bmsProjectDocCatalog.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }
    
    public TreeSelect(BmsMdExpertType bmsMdExpertType)
    {
        this.id = bmsMdExpertType.getGuid();
        this.label = bmsMdExpertType.getCname();
        this.type = bmsMdExpertType.getType();
        this.children = bmsMdExpertType.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(BmsMdArea bmsMdArea)
    {
        this.id = bmsMdArea.getGuid();
        this.label = bmsMdArea.getCname();
        this.type = bmsMdArea.getType().toString();
        this.children = bmsMdArea.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(BmsMdIndustryCategory bmsMdIndustryCategory)
    {
        this.id = bmsMdIndustryCategory.getGuid();
        this.label = bmsMdIndustryCategory.getCname();
        this.type = bmsMdIndustryCategory.getType().toString();
        this.children = bmsMdIndustryCategory.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getLabel()
    {
        return label;
    }

    public void setLabel(String label)
    {
        this.label = label;
    }

    public List<TreeSelect> getChildren()
    {
        return children;
    }

    public void setChildren(List<TreeSelect> children)
    {
        this.children = children;
    }

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
}
